
cmake_minimum_required(VERSION 3.10)

project(distributedMQ)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-Wall)
add_definitions(-DDEBUG)
add_definitions(-DZMQ_BUILD_DRAFT_API)

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
    add_compile_options(
        -Wno-format
        -Wno-reorder
        -Wno-unused-function
        -Wno-pessimizing-move
        -Wno-narrowing
        -Wno-sign-compare
        -Wno-unused-variable
        -Wno-int-in-bool-context
        -Wno-switch
        -Wno-class-memaccess
        -Wno-unused-but-set-variable
        -Wno-return-type
    )
endif()


# 设置IWYU的路径
# find_program(IWYU_PATH include-what-you-use)

# if(IWYU_PATH)
#   set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH}")
# endif()


find_package(PkgConfig REQUIRED)
# find_package(redis-plus-plus REQUIRED)
find_package(Threads)
find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem context)
find_package(Protobuf REQUIRED)
pkg_check_modules(dependencies
                  msgpack REQUIRED
                  hiredis REQUIRED)

include_directories(
    zeroplusmq
    zeroplusmq/base
    zeroplusmq/network
    zeroplusmq/network/codec
    zeroplusmq/network/connection
    zeroplusmq/network/model
    zeroplusmq/network/reactor
    zeroplusmq/component
    zeroplusmq/component/broker
    zeroplusmq/monitor
    zeroplusmq/store
    zeroplusmq/store/queue
    zeroplusmq/utils
    ${dependencies_LIBRARIES}
    ${Boost_INCLUDE_DIRS}
    ${PROTOBUF_INCLUDE_DIR}
)


# 库文件路径
set(LIBS
    gflags
    glog
    pthread
    zmq
    zmqpp
    hiredis
    redis++
    yaml-cpp
    z
    ${dependencies_INCLUDE_DIRS}
    ${Boost_LIBRARIES}
    ${Protobuf_LIBRARIES}
)




add_subdirectory(zeroplusmq)
add_subdirectory(examples)
# add_subdirectory(tests)


configure_file(Procfile Procfile)

install(DIRECTORY zeroplusmq
        DESTINATION include
        FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")

# 安装 Procfile
install(FILES Procfile DESTINATION ./)